<div class="left-column span3 ml-0 fl">
    <h4 class="block-title">Danh mục sản phẩm</h4>
    <div class="ruler">
    </div>
    <ul class="categories">
        <?php 
            $listMenuNav = Category::model()->getMenuNav();
            if($listMenuNav){
                foreach ($listMenuNav as $value) {
                    ?>
                    <li>
                        <i class="icon-angle-right"></i>
                        <a href="<?php echo $this->createUrl('/product/list', array('id' => $value->id))?>"><?php echo $value->name ?></a>
                        <?php
                            $listMenuSub1 = Category::model()->getMenuSub($value->id, $value->level+1);
                            if($listMenuSub1){
                                echo "<ul class='categories-submenu'>";
                                foreach ($listMenuSub1 as $value1) {
                                    echo "<li>";
                                    echo "<i class='icon-angle-right'></i><a href='".$this->createUrl("/product/list", array("id" => $value1->id))."'>".$value1->name."</a>";
                                    $listMenuSub2 = Category::model()->getMenuSub($value1->id, $value1->level+1);
                                    if($listMenuSub2){
                                        echo "<ul class='categories-submenu'>";
                                        foreach ($listMenuSub2 as $value2) {
                                            echo "<li><i class='icon-angle-right'></i><a href='".$this->createUrl("/product/list", array("id" => $value2->id))."'>".$value2->name."</a></li>";
                                        }
                                        echo "</ul>";
                                    }
                                    echo "</li>";
                                }
                                echo "</ul>";
                            }
                        ?>
                        
                    </li>
                    <?php
                }
            }
        ?>
    </ul>
    
</div>

<div class="span9 mt-10">
    <div class="fl products-viewmode">
            <a href="<?php echo $this->createUrl('/product/list', array('id' => $category->id))?>" class="active fl"><i class="icon-th-large"></i> Grid</a>
            <a href="<?php echo $this->createUrl('/product/listgrid', array('id' => $category->id))?>" class="fl"><i class="icon-th-list"></i> List</a>
    </div>
    
    <div class="ruler">
    </div>
</div>


<div class="span9 fr">
    
    <div class="products-grid clearfix row-fluid">
        <?php 
            foreach ($items as $item) {
                ?>
                 <div class="product fl">
                    <?php
                        if($item['is_new']==1) echo"<div class='product-new'>
                            </div>";
                        if($item['is_sale']==1) echo"<div class='product-sale'>
                            </div>";
                    ?>
                    <div class="product-preview">
                            <img src="<?php echo Yii::app()->request->baseUrl . $item['avatar'] ?>" 
                                 alt="<?php echo Yii::app()->request->baseUrl . $item['name'] ?>"
                                 title="<?php echo Yii::app()->request->baseUrl . $item['name'] ?>">
                    </div>
                    <div class="product-info">
                            <h5><a href="<?php echo Yii::app()->createUrl('/product/detail', array('id' => $item['id'])) ?>" title="<?php CHtml::encode($item['name']);?>">
                                    <?php echo CHtml::encode(StringHelper::helper()->cutText($item['name'], 56));?>
                                </a>
                            </h5>
                            <h4><?php echo number_format($item['price'],0,",","."); ?> đ</h4>
                            <div class="button-box" style="text-align: center; margin: 0px;">
                                    <div>
                                            <i class="icon-shopping-cart"></i>
                                            <span style="text-align: center">Add to cart</span>
                                    </div>
                            </div>
                    </div>
                </div>   
                <?php
            }
        ?>
            
            
    </div>
    <div id="pagination">
        <?php 
        $this->widget('bootstrap.widgets.TbPager', array(
            'pages' => $pages,
            'htmlOptions' => array('class' => 'pager'),
            'header' => ''
        ));
        ?>

    </div>
</div>